﻿using Autofac;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using System.Web;

namespace Hrm.Web.Framework
{
    public class BaseController : Controller
    {
        public BaseController()
            : base()
        {

        }

        public List<string> GetCurrentUserRoleCodes()
        {
            List<string> result = new List<string>();
            var data =HttpContext.Request.GetOwinContext().Authentication.User.Claims;
            var entity = data.FirstOrDefault(a => a.Type == ClaimTypes.Role);
            if (entity != null)
            {
                result = entity.Value.Split(',').ToList();
            }
            return result;
        }
    }
}
